{{ $site:=site }}
<!-- 查询 content 列表 -->
{{ $selectList := selectList "content" .q .pageNo 12 "* FROM content WHERE status in (1,2) order by status desc,sortNo desc" }}

<!DOCTYPE html>
<html lang="zh-CN">

<head>
	<title>{{ $site.Title }}</title>
	<meta name="description" content="{{ $site.Description }}" />
	<meta name="keyword" content="{{ $site.Keyword }}" />

	{{template "bodystart.html" }}
	<input type="hidden" id="search-q" value="{{$.q}}" />

	<main id="main" class="site-main">
		<div class="ast-row">

			{{ range $k,$v := $selectList.Data }}
			<article id="{{$v.Id}}" class="{{$v.Id}} post type-post status-publish format-standard hentry category-uncategorized ast-grid-common-col ast-full-width ast-article-post remove-featured-img-padding" itemtype="https://schema.org/CreativeWork" itemscope="itemscope">
				<div class="ast-post-format- ast-no-thumb blog-layout-4 ast-article-inner">
					<div class="post-content ast-grid-common-col">
						<div class="ast-blog-featured-section post-thumb ast-blog-single-element"></div>
						<span class="ast-blog-single-element ast-taxonomy-container cat-links default">
							<a href="{{basePath}}{{ trimSlash .CategoryID}}" rel="category tag">{{ $v.CategoryName }}</a></span>
						<h2 class="entry-title ast-blog-single-element" itemprop="headline">
							<a href="{{basePath}}{{ trimPrefixSlash $v.Id}}" rel="bookmark">{{$v.Title}}</a>
						</h2>
						<header class="entry-header ast-blog-single-element ast-blog-meta-container">
							<div class="entry-meta">
								<span class="posted-by vcard author" itemtype="https://schema.org/Person" itemscope="itemscope" itemprop="author"> 
										<span class="author-name" itemprop="name">{{$v.Author}} </span>
								</span>

								/ <span class="posted-on"><span class="published" itemprop="datePublished"> {{ slice $v.UpdateTime 0 10 }}
									</span></span></div>
						</header><!-- .entry-header -->
						<div class="ast-excerpt-container ast-blog-single-element">
							{{ .Summary }}
						</div>
						<div class="entry-content clear" itemprop="text">
						</div><!-- .entry-content .clear -->
					</div><!-- .post-content -->
				</div> <!-- .blog-layout-4 -->
			</article><!-- #post-## -->
			{{end}}


		</div>

	</main><!-- #main -->
	{{if gt $selectList.Page.PageCount 1}}
	<div class='ast-pagination'>
		<nav class="navigation pagination" role="navigation" aria-label="Post pagination">
			<span class="screen-reader-text">Post pagination</span>
			<div class="nav-links">
				{{$currPageNo := $selectList.Page.PageNo}}
				{{if lt $currPageNo 1}}
				  {{$currPageNo = 1}}
				{{end}}
				{{if gt $currPageNo $selectList.Page.PageCount }}
				   {{$currPageNo = $selectList.Page.PageCount}}
				{{end}}
				{{if gt $currPageNo 1}}
				<a class="prev page-numbers" href="{{basePath}}page/{{ addInt $currPageNo -1 }}?q={{.q}}">
					<span class="ast-left-arrow">&larr;</span> 上一页
				</a>
				{{end}}

				{{ range $index, $value := (seq 1 $selectList.Page.PageCount) }}
				{{ if eq $currPageNo $value }}
				<span aria-current="page" class="page-numbers current">{{$value}}</span>
				{{else}}
				<a class="page-numbers" href="{{basePath}}page/{{$value}}?q={{$.q}}">{{$value}}</a>
				{{end}}  
			   {{ end }}

			   {{if lt $currPageNo $selectList.Page.PageCount}}
				<a class="next page-numbers" href="{{basePath}}page/{{ addInt $currPageNo 1 }}?q={{$.q}}">下一页 
					<span class="ast-right-arrow">&rarr;</span>
				</a>
			   {{end}}  

			</div>
		</nav>
	</div>
	{{end}}

	{{template "bodyend.html" }}

	<script>
		var search = document.getElementById("search-q").value;
		if (search) {
			document.getElementById("search-field").value = search;
		}
	</script>